package com.ejd.web.vo.common;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import com.ejd.web.bo.AbstractOrder;
import com.ejd.web.bo.impl.Customer;
import com.ejd.web.bo.impl.OrderDetail;

public class OrderVo extends AbstractOrder {
	
	private static final long serialVersionUID = -8106629465344224743L;
	private CustomerVo customer = new CustomerVo();
	private Set<OrderDetailVo> orderDetails = new HashSet<OrderDetailVo>();
	public OrderVo(){
		
	}
	public CustomerVo getCustomer() {
		return customer;
	}
	public void setCustomer(CustomerVo customer) {
		this.customer = customer;
	}
	public Set<OrderDetailVo> getOrderDetails() {
		return orderDetails;
	}
	public void setOrderDetails(Set<OrderDetailVo> orderDetails) {
		this.orderDetails = orderDetails;
	}
	public List<OrderDetailVo> getOrderDetailsDataModel(){
		List<OrderDetailVo> result = new ArrayList<OrderDetailVo>();
		if (null != this.getOrderDetails() && !(this.getOrderDetails().isEmpty())) {
			Iterator<OrderDetailVo> it = this.getOrderDetails().iterator();
			while (it.hasNext()) {
				OrderDetailVo tempOrderDetail= new OrderDetailVo();
				tempOrderDetail = it.next();
				result.add(tempOrderDetail);
			}
		}
		return result;
	}
	
}
